package com.mashuai.utils.ztest.toolkit.file;

import com.mashuai.utils.toolkit.core.msConverts.MsConvertDataUtils;
import com.mashuai.utils.toolkit.core.msFile.MsFileUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.InputStream;
import java.util.Map;

@RequestMapping("/ms/file")
@RestController
public class FileController {

    /**
     * 读取某个文件的json
     * @param
     * @return void
     * @Author: 马帅
     **/
    @GetMapping("/readJson")
    public void readJson(){
        InputStream inputStream = MsFileUtils.getResourcesFile("/static/template/Map.json");
        String result  = MsFileUtils.readInputStreamAsString(inputStream);
        //转为map
        Map<String, Object> resultMap = MsConvertDataUtils.strToMap(result);
        System.err.println(result);
    }
}
